import './index.scss';
import { ThemeContext } from '../../context';

class Header extends React.Component {
  render() {
    return (
      //拿到父组件传递的value
      //将theme的值应用到class类里形成动态的类名
      <ThemeContext.Consumer>
        {(theme) => (
          <header className={`header ${theme}`}>{this.props.children}</header>
        )}
      </ThemeContext.Consumer>
    );
  }
}

export default Header;
